from peewee import *
from model import Project as ModelProject
from model import Mysql


class Process(Model):
    """
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `ip` varchar(50) NOT NULL,
  `port` varchar(6) NOT NULL,
  `create_time` datetime NOT NULL,
  `status` tinyint(1) NOT NULL, 能否访问
  `project_id` int unsigned NOT NULL,
  PRIMARY KEY (`id`),
  constraint `fk_1` foreign key (`project_id`) references `project` (`id`)
    """
    id = AutoField(primary_key=True)
    ip = CharField(null=False)
    port = CharField(null=False)
    create_time = DateTimeField(null=False)
    status = BooleanField(null=False)
    project_id = ForeignKeyField(ModelProject.Project, constraint_name="id")

    class Meta:
        database = Mysql.db


